fix(workspace): Add missing d3fc CSS variables for chart plugins #3102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3101
Chart plugins (Y Line, Y Bar, Y Area, X Bar, etc.) crash when used inside
<perspective-workspace>with the error:Root Cause
The workspace theme files (
pro.lessandpro-dark.less) were missing the d3fc CSS variable definitions. Theperspective-viewerthemes include@include perspective-viewer-pro--d3fcwhich defines variables like--d3fc-series, but the workspace themes only includedperspective-viewer-pro--colors.When
colorStyles.tstries to read--d3fc-seriesviagetComputedStyle(), it gets an empty string, which causesd3.color(null)to returnnull, and accessing.opacityonnullthrows the error.Changes
packages/workspace/src/themes/pro.less: Add@include perspective-viewer-pro--d3fcpackages/workspace/src/themes/pro-dark.less: Add@include perspective-viewer-pro-dark--d3fcpackages/viewer-d3fc/src/ts/series/colorStyles.ts: Add defensive null check ingetOpacityFromColor()as additional protectionTesting
Before fix: Charts crash immediately when rendering in workspace
After fix: Charts render correctly with proper colors
Checklist